package router

import (
	jwt "gitee.com/sansaniot/ssiot-core/httpmvc/jwtauth"
	"github.com/gin-gonic/gin"

	"ssadmin/common/constant"
	"ssadmin/internal/admin/apis"
)

func init() {
	AuthRouters = append(AuthRouters, registerFileRouter)
}

func registerFileRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
	api := apis.File{}
	r := v1.Group("/api/file").Use(authMiddleware.MiddlewareFuncWithOutValidate())
	{
		r.POST("/upload", api.UploadFile)
		r.POST("/remove", api.DeleteFile)
	}

	v1.Static("/api/file/download", constant.FilePath)
}
